package com.ruoyi.safe.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.safe.mapper.CommonCooperatorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.safe.mapper.CommonCooperatorBadnessMapper;
import com.ruoyi.safe.domain.CommonCooperatorBadness;
import com.ruoyi.safe.service.ICommonCooperatorBadnessService;

/**
 * 合作单位-不良记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-11-08
 */
@Service
public class CommonCooperatorBadnessServiceImpl implements ICommonCooperatorBadnessService 
{
    @Autowired
    private CommonCooperatorBadnessMapper commonCooperatorBadnessMapper;
    @Autowired
    private CommonCooperatorMapper commonCooperatorMapper;

    /**
     * 查询合作单位-不良记录
     * 
     * @param id 合作单位-不良记录主键
     * @return 合作单位-不良记录
     */
    @Override
    public CommonCooperatorBadness selectCommonCooperatorBadnessById(Long id)
    {
        return commonCooperatorBadnessMapper.selectCommonCooperatorBadnessById(id);
    }

    /**
     * 查询合作单位-不良记录列表
     * 
     * @param commonCooperatorBadness 合作单位-不良记录
     * @return 合作单位-不良记录
     */
    @Override
    public List<CommonCooperatorBadness> selectCommonCooperatorBadnessList(CommonCooperatorBadness commonCooperatorBadness)
    {
        return commonCooperatorBadnessMapper.selectCommonCooperatorBadnessList(commonCooperatorBadness);
    }

    /**
     * 新增合作单位-不良记录
     * 
     * @param commonCooperatorBadness 合作单位-不良记录
     * @return 结果
     */
    @Override
    public int insertCommonCooperatorBadness(CommonCooperatorBadness commonCooperatorBadness)
    {
        commonCooperatorBadness.setCreateTime(DateUtils.getNowDate());
        commonCooperatorBadness.setCreateBy(SecurityUtils.getUsername());
        return commonCooperatorBadnessMapper.insertCommonCooperatorBadness(commonCooperatorBadness);
    }

    /**
     * 修改合作单位-不良记录
     * 
     * @param commonCooperatorBadness 合作单位-不良记录
     * @return 结果
     */
    @Override
    public int updateCommonCooperatorBadness(CommonCooperatorBadness commonCooperatorBadness)
    {
        commonCooperatorBadness.setUpdateTime(DateUtils.getNowDate());
        commonCooperatorBadness.setUpdateBy(SecurityUtils.getUsername());
        return commonCooperatorBadnessMapper.updateCommonCooperatorBadness(commonCooperatorBadness);
    }

    /**
     * 批量删除合作单位-不良记录
     * 
     * @param ids 需要删除的合作单位-不良记录主键
     * @return 结果
     */
    @Override
    public int deleteCommonCooperatorBadnessByIds(Long[] ids)
    {
        return commonCooperatorBadnessMapper.deleteCommonCooperatorBadnessByIds(ids);
    }

    /**
     * 删除合作单位-不良记录信息
     * 
     * @param id 合作单位-不良记录主键
     * @return 结果
     */
    @Override
    public int deleteCommonCooperatorBadnessById(Long id)
    {
        return commonCooperatorBadnessMapper.deleteCommonCooperatorBadnessById(id);
    }
}
